import logging
from BeautifulReport import BeautifulReport
import yagmail
import unittest

def send_log():
    logging.basicConfig(
        filename='rz.log',
        filemode='w+',
        level=logging.DEBUG,
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    )


def send_baogao():
    report=unittest.defaultTestLoader.discover(start_dir='.', pattern='test_*.py')
    port=BeautifulReport(report)
    port.report(filename='baogao.html',description='测试报告',report_dir='./')


def send_email():
    man=yagmail.SMTP(user='3052175947@qq.com',password='vkxpdgwiysladeei',host='smtp.qq.com')
    man.send(to='3052175947@qq.com',subject='qq邮件')



if __name__ == '__main__':
    send_baogao()
    send_log()
